package com.shelpe.services.lexicon.entity;

import java.util.ArrayList;
import java.util.List;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import com.shelpe.services.lexicon.constants.Device;
import com.shelpe.services.lexicon.constants.Origin;

import lombok.Getter;
import lombok.Setter;

@Document(collection="keywords")
@Setter
@Getter
public class Keyword extends BaseEntity {

	@Id
	private String keywordID;
	@Indexed
	private String word;
	
	private Origin origin = Origin.taobao;//来源
	
	private Device device = Device.all;//设备
	
	private List<KeywordTag> tags;
	
	public void addTag(KeywordTag tag){
		if(this.tags == null){
			this.tags = new ArrayList<KeywordTag>();
		}
		this.tags.add(tag);
	}
	
}
